﻿/********************************************************************************
** @ Date:2025/05/29
** @ Author: Gaojia
** @ Description:
** @ Version:1.0.0
** @ Fun:
********************************************************************************/
#ifndef CAlgorithmBase_H
#define CAlgorithmBase_H
#include "CDevBase.h"
#include "CRBaseData.h"
#include <qobject.h>
#include <Qtimerevent>
class CAlgorithmBase :
	public QObject
{
	Q_OBJECT
public:
	CAlgorithmBase();
	CAlgorithmBase(QString sSceneId);
	void init(CDevBase * pDev, CRBaseData * pRBasicData);
	~CAlgorithmBase();
	virtual bool actionAlgorthm(SCPolItemCom *pPolItemCom, QString sTaskName); //算法处理
	virtual bool stopAlgorthm(SCPolItemCom *pPolItemCom); //停止算法处理
	virtual void closeCotDet();
protected:
	bool isCollectRoller(int nVal, int nInterval);
	bool isCollectMeter(double dVal, double dInterval);
	QString m_sGuid;
	CDevBase *m_pDev;
	CRBaseData *m_pRBasicData;
	SCPolItemCom *m_pPolItemCom;
	bool m_bConllectBegin;                 //持续采集起点
	int  m_nExecTimer;                     //心跳定时器
	/**
	* @ Author: Gaojia
	* @ Description: 判断托辊号
	*/
	int m_nDirection;                      //0无方向  1 正向 2反向
	int m_nPositive;                       //正向计数
	int m_nReverse;                        //反向计数
	/**
	* @ Author: Gaojia
	* @ Description: 托辊号判断
	*/
	int m_nLastConRollerNum;               //上一次持续检测托辊号
	int m_nLastRollerNum;                  //上一次报警托辊号

	/**
	* @ Author: Gaojia
	* @ Description: 间隔位置判断
	*/
	double m_dLastLocation;                //最近一次报警位置
	double m_dLastConLocation;             //最近一次连续检测拍照的位置
};

#endif